package com.haruhinav.Utils;

import com.haruhinav.ws.ChatEndpoint;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;
@Component
public class ChatUserUtil {
//    获取聊天室所有在线用户在线
    public List<Object> getOnLineUsers(CopyOnWriteArraySet<ChatEndpoint> chatEndpoints){
        List<Object> onLineUsers = new ArrayList<>();
        chatEndpoints.forEach(ce->{
            onLineUsers.add(ce.resultMessage.getData());
        });
        return onLineUsers;
    }
}
